package argo.hot150.w2;


import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;

public class HashFUn {


    /**
     * 字母异位词 是由重新排列源单词的所有字母得到的一个新单词。
     * <p>
     * 示例 1:
     * <p>
     * 输入: strs = ["eat", "tea", "tan", "ate", "nat", "bat"]
     * 输出: [["bat"],["nat","tan"],["ate","eat","tea"]]
     * 示例 2:
     * <p>
     * 输入: strs = [""]
     * 输出: [[""]]
     * 示例 3:
     * <p>
     * 输入: strs = ["a"]
     * 输出: [["a"]]
     */

    private boolean HashCharCompare(String str1, String str2) {
        if (str1 == null || str2 == null) {
            return false;
        }

        if (str1.length() != str2.length()) {
            return false;
        }

        Map<Character, Integer> strCharStatic1 = new HashMap<>();

        for (int i = 0; i < str1.length(); i++) {
            char strChar = str1.charAt(i);
            strCharStatic1.put(strChar, strCharStatic1.getOrDefault(strChar, 1));
        }

        for (int i = 0; i < str2.length(); i++) {
            char strChar = str2.charAt(i);
            if (!strCharStatic1.keySet().contains(strChar)) {
                return false;
            }

        }


        return true;
    }


/*    public List<List<String>> groupAnagrams(String[] strs) {

        List<List<String>> result = new ArrayList<>();


    }*/


    public static void main(String[] args) {

    }
}
